<template>
  <div class="new-card" @click="toDetail">
    <div class="new-card_title">
      <div class="left">
        <img :src="data.tx" alt="" width="20" height="20" /><span
          >{{ data.name }} · {{ data.zw }}</span
        >
      </div>
      <div class="right">{{ data.time }}</div>
    </div>
    <div class="new-card_content">
      <div class="cont_text" v-if="data.type == '1'">
        <div class="text">{{ data.nr }}</div>
      </div>
      <div class="cont_text2" v-else>
        <div class="text">{{ data.nr }}</div>
        <img :src="data.nrImg" alt="" width="100" height="60" />
      </div>
    </div>
    <div class="new-card_bottom">{{ data.rs }}人回答 · {{ data.lls }}浏览</div>
  </div>
</template>

<script>
export default {
  props: {
    data: Object,
  },
  methods: {
    toDetail() {
      this.$emit("click-item", this.data);
    },
  },
};
</script>

<style lang="scss" scoped>
.new-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 13px 16px;
  &_title {
    display: flex;
    .left {
      flex: 1;
      span {
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 12px;
        color: #272b2d;
      }
      img {
        border-radius: 50%;
        margin-right: 3px;
      }
    }
    .right {
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      font-size: 12px;
      color: #676b6b;
    }
  }
  &_content {
    margin: 9px 0;
    .cont_text {
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      font-size: 16px;
      color: #272b2d;
      line-height: 22px;
    }
    .cont_text2 {
      display: flex;
      img {
        margin-left: 18px;
      }
    }
    .text {
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
  }
  &_bottom {
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 12px;
    color: #676b6b;
    line-height: 17px;
  }
}
</style>
